LinearInterpFloatDouble Function

private function LinearInterpFloatDouble(x1, x2, y1, y2, x) result(y)

calculates linear interpolation between real numbers. Output is a double real

Arguments

Type IntentOptional Attributes Name
real(kind=float), intent(in) :: x1
real(kind=float), intent(in) :: x2
real(kind=double), intent(in) :: y1
real(kind=double), intent(in) :: y2
real(kind=float), intent(in) :: x

Return Value real(kind=double)


Source Code

FUNCTION LinearInterpFloatDouble  &
  ( x1, x2, y1, y2, x )     &
RESULT (y)

IMPLICIT NONE

! Function arguments
! Scalar arguments with intent(in):
REAL (KIND = float), INTENT (IN) :: x1, x2, x
REAL (KIND = double), INTENT (IN) :: y1, y2


! Scalar arguments with intent (out):
REAL (KIND = double) :: y

!------------end of declaration------------------------------------------------

y = y1 + ( y2 - y1 ) / ( x2 - x1 ) * ( x - x1 )

END FUNCTION LinearInterpFloatDouble